﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Windows.Media.Animation;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Media3D;
using System.Windows.Markup;
using System.Windows.Media;
using System.Globalization;
using CrazyWorship1.PropertyHandler;
using CrazyWorship1.Properties;

namespace CrazyWorship1.Creators
{
    public class CreateAllVideo:CreateAllBase
    {



        public override void SetupPanes()
        {

            
           
            int i = 0;
            foreach (DataRowView a in CurrentState.CurrentLyrics)
            {
                Point3D point = new Point3D(_xOffset*i, _yOffset*i, _zOffset*i);
                SongDB.LyricsRow b = (SongDB.LyricsRow)a.Row;
                CreateTextPanel(TextModelGroup, b.LyricID, b.Text, b.Style, point, Rotation3D.Identity, new Point3D(0, 0, 0), new Vector3D(1, 1, 1));
                MediaPlayer mp = new MediaPlayer();
                mp.Open(new Uri("D:\\Videos\\My Videos\\BCOQ\\Avalanche\\2002\\01-Avalanche Video.wmv"));
                mp.Volume = 0.25;            
                VideoDrawing vd = new VideoDrawing();
                vd.Player = mp;
                vd.Rect = new Rect(0, 0, 10000, 10000);
    
                DrawingBrush db = new DrawingBrush();
                db.Drawing = vd;






                ((DiffuseMaterial)((GeometryModel3D)TextModelGroup.Children[0]).Material).Brush = db;
                  
       
                   vd.Player.Play();
                SetIn(b.LyricID, b.InStoryBoard);
                SetOut(b.LyricID, b.OutStoryBoard);
                i++;
            }
            SetSongIn(CurrentState.CurrentSong.InStoryBoard);
            SetSongOut(CurrentState.CurrentSong.OutStoryBoard);
        }
        private double _zOffset;
        [DataAttribute("ZOffset",typeof( DoublePropertyHandler),"CreateAllVideoDefaultZOffset")]
        public string ZOffset
        {
            get
            {
                return _zOffset.ToString(CultureInfo.InvariantCulture);
            }
            set
            {
                _zOffset = Convert.ToDouble(value, CultureInfo.InvariantCulture);
            }
        }
        private double _yOffset;
        [DataAttribute("YOffset", typeof(DoublePropertyHandler), "CreateAllVideoDefaultYOffset")]
        public string YOffset
        {
            get
            {
                return _yOffset.ToString(CultureInfo.InvariantCulture);
            }
            set
            {
                _yOffset = Convert.ToDouble(value, CultureInfo.InvariantCulture);
            }
        } private double _xOffset;
        [DataAttribute("XOffset", typeof(DoublePropertyHandler), "CreateAllVideoDefaultXOffset")]
        public string XOffset
        {
            get
            {
                return _xOffset.ToString(CultureInfo.InvariantCulture);
            }
            set
            {
                _xOffset = Convert.ToDouble(value, CultureInfo.InvariantCulture);
            }
        }


      

      

       
    }
}
